package ul;/*
@Date:2024/12/3
*/

import service.HouseService;
import tool.Utility;

import java.sql.SQLException;

public class HouseView {
    public HouseView() {
    }

    public void mianMenu() throws SQLException {
        final HouseService houseService = new HouseService();
        if (houseService.isUser()) {
            do {
                System.out.println("-----房屋出租管理系统-----");
                System.out.println("     1 新增房源");
                System.out.println("     2 查找房源");
                System.out.println("     3 删除房源");
                System.out.println("     4 修改房屋信息");
                System.out.println("     5 房屋列表");
                System.out.println("     6 退出");
                System.out.println("    请选择（1-6）");

                char x = Utility.readMenuSelection();
                switch (x) {
                    case '1':

                        System.out.println(houseService.add());
                        break;
                    case '2':
                        // System.out.println(houseService.findByld());
                        houseService.findByld();
                        break;
                    case '3':
                        houseService.del();
                        break;
                    case '4':
                        houseService.chang();
                        break;
                    case '5':
                        houseService.list();
                        break;
                    case '6':
                        return;
                }
            } while (true);
        }

    }
}

